#include <2025Linux.h>
typedef struct student_s {
    int num;
    //char *name;
    char name[20]; //推荐用这种方法，因为文件里面一般不保存指针
    float score;
} student_t;
int main(int argc, char *argv[])
{
    // ./04_student_write file1
    ARGS_CHECK(argc,2);
    int fd = open(argv[1],O_RDWR);
    student_t stu[3] = {
        {1,"Caixukun",88.8},
        {2,"Wuyifan",59.9},
        {3,"Liyifeng",77.7}
    };
    write(fd,stu,sizeof(stu)); // stu可以不用取地址
    close(fd);
    return 0;
}

